<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>我的</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui,viewport-fit=cover"/>
    <meta name="keywords" content="我的">
    <meta name="description" content="我的">
    <script type="text/javascript" src="js/base.js" charset="UTF-8"></script>
    <!-- <link rel="stylesheet" type="text/css" href="css/theme-chalk/index.css"> -->
    <!-- <link rel="stylesheet" type="text/css" href="css/swiper-bundle.min.css"> -->
    <link rel="stylesheet" type="text/css" href="css/base.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script type='text/javascript' src="js/jquery.min.js" charset="UTF-8"></script>
    <!-- <script type='text/javascript' src="js/html2canvas.min.js" charset="UTF-8"></script> -->
    <script type="text/javascript" src="js/layer/layer.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/vue.js" charset="UTF-8"></script>
    <script type="text/javascript" src="js/axios.min.js" charset="UTF-8"></script>
    <!-- <script type='text/javascript' src="js/elementui.min.js" charset="UTF-8"></script> -->
    <!-- <script type='text/javascript' src="js/swiper-bundle.min.js" charset="UTF-8"></script> -->
    <script type='text/javascript' src="../common/js/helper.js" charset="UTF-8"></script>
</head>
<body>
    <div class="wrapperbox mypage hasmenu" id="app">
        <div class="hzsq">
            <h2><span>抱团商家合作申请表</span></h2>
            <h3>如果您是菏泽商家或可提供优秀的产品请与我们联系</h3>
            <div class="content">
                <div class="input"><input type="text" v-model="shname" placeholder="请填写商户名称"></div>
                <div class="input"><input type="text" v-model="shaddress" placeholder="请填写商户地址"></div>
                <div class="input"><input type="text" v-model="username" placeholder="请填写您的姓名"></div>
                <div class="input"><input type="text" v-model="mobile" placeholder="请填写您的手机号"></div>
                <div class="input"><input type="text" v-model="other" placeholder="请填写可添加微信的手机号或微信号"></div>
                <div class="btn" @click="gosubhz">提交</div>
            </div>
        </div>
        <div class="indexbotmenu">
            <a href="./index.html" class="item">
                <div class="img"><img src="images/index-botmenu-ico1.png" alt=""></div>
                <p>首页</p>
            </a>
            <a href="./order.html" class="item">
                <div class="img"><img src="images/index-botmenu-ico2.png" alt=""></div>
                <p>订单</p>
            </a>
            <a href="./my.html" class="item">
                <div class="img"><img src="images/index-botmenu-ico3.png" alt=""></div>
                <p>我的</p>
            </a>
        </div>
    </div>
</body>
<script>
    new Vue({
        el: '#app',
        data () {
            return {
                shname:'',
                shaddress:'',
                username:'',
                mobile:'',
                other:'',
                allowclick:true,
            }
        },
        mounted () {
            
            var that=this;
        },
        methods: {
            gosubhz:function(){
                var that=this;
                var shname=that.shname;
                var shaddress=that.shaddress;
                var username=that.username;
                var mobile=that.mobile;
                var other=that.other;
                var checkmobile=/^1(3|4|5|6|7|8|9)\d{9}$/;  
                if(that.allowclick==true){
                    that.allowclick=false;
                    if(!shname){
                        layer.msg('请填写商户名称');
                        that.allowclick=true;
                        return false;
                    }
                    if(!shaddress){
                        layer.msg('请填写商户地址');
                        that.allowclick=true;
                        return false;
                    }
                    if(!username){
                        layer.msg('请填写您的姓名');
                        that.allowclick=true;
                        return false;
                    }
                    if(!mobile){
                        layer.msg('请填写您的手机号');
                        that.allowclick=true;
                        return false;
                    }else if(!checkmobile.test(mobile)){
                        layer.msg('您填写的手机号有误，请重新填写');
                        that.allowclick=true;
                        return false;
                    }
                    if(!other){
                        layer.msg('请填写可添加微信的手机号或微信号');
                        that.allowclick=true;
                        return false;
                    }
                    that.allowclick=true;
                    common_post('cooperates',{
                        "merchant_name": shname,
                        "merchant_address": shaddress,
                        "name": username,
                        "mobile": mobile,
                        "wechat_id": other
                    }).then(res => {
                        layer.msg('提交成功');
                        setTimeout(()=>{
                            that.shname='';
                            that.shaddress='';
                            that.username='';
                            that.mobile='';
                            that.other='';
                        },3000)
                    })
                }
            },
        }
    });
</script>
</html>